<!-- $Id: package.html 471661 2006-11-06 08:09:25Z skitching $
  
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at
  
       http://www.apache.org/licenses/LICENSE-2.0
  
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
--> 
<html>
<head>
<title>Package Documentation for org.apache.commons.digester.substitution Package</title>
</head>
<body bgcolor="white">
Provides for manipulation of xml attributes and element body text before
the data is processed by any Rule objects.
<br><br>
<p>
The class org.apache.commons.digester.Substitutor defines an abstract
interface for mechanisms which manipulate xml attributes and body text.
The Digester method setSubstitutor can be used to define a concrete
substitutor that will be applied to the data before it is passed to the
matching rules.
</p>
<p>
This package provides some useful concrete implementations of the abstract
Substitutor class. In particular, it provides an implementation that allows
the application to define "variables" which the input data can reference
using a syntax such as "${user.name}".
</p>
<p>Here's an example of setting up the VariableSubstitutor:</p>
<pre>
  // set up the variables the input xml can reference
  Map vars = new HashMap();
  vars.put("user.name", "me");
  vars.put("os", "Linux");
  
  // map ${varname} to the entries in the var map
  MultiVariableExpander expander = new MultiVariableExpander();
  expander.addSource("$", vars);

  // allow expansion in both xml attributes and element text
  Substitutor substitutor = new VariableSubstitutor(expander);

  Digester digester = new Digester();
  digester.setSubstitutor(substitutor);
</pre>
</body>
</html>
